{{response.files.append(URL(r=request,c='static',f='jquery.dataTables.min.js'))}}
{{response.files.append(URL(r=request,c='static',f='demo_table.css'))}}
{{response.files.append(URL(r=request,c='static',f='jqModal.css'))}}
{{response.files.append(URL(r=request,c='static',f='jqModal.js'))}}
{{extend 'layout.html'}}
<script>
jQuery(document).ready(function(){
   jQuery('.smarttable').dataTable(); 
   {{for log in logs:}}jQuery('#dialog{{=log.id}}').jqm({trigger: '#trigger{{=log.id}}'});{{pass}}
});
</script>
<h1>Communication Logs for {{=link_person(person)}}</h1>

[<a href="#nil" onclick="jQuery('#form').slideToggle();">toggle</a>]
<div id="form">
<h2>New Communication Log</h2>
{{=form}}
</div>

<br /><br />
<table class="smarttable">
<thead>
  <tr>
     <th>Created On</th><th>By</th><th>Communication</th>
  </tr>
</thead>
<tbody>
{{for log in logs:}}
<tr>
<td>{{=log.created_on}}</td>
<td>{{=log.created_by.first_name}} {{=log.created_by.last_name}}</td>
<td>
  {{=log.body[:32]}}...[<a href="#" id="trigger{{=log.id}}">more</a>]
  <div class="jqmWindow" id="dialog{{=log.id}}">[<a href="#" class="jqmClose">Close</a>]<hr />{{=log.body}}
  {{=tag('log',log.id)}}
</div>
</td>
</tr>
{{pass}}
</tbody>
</table>
